package crono;

import config.Config;

public class Cronometro {
	private long start = -1;
	private long durationMs = -1;

	public void start() {
		start = System.currentTimeMillis();
	}

	public void stop() {
		long end = System.currentTimeMillis();
		durationMs = end - start;
	}

	public void printThroughput(String msg) {
		int throughput = (int) ((Config.OBJ_COUNT * 1000) / durationMs);
		System.out.printf(msg + ". Throughput: %d obj/s.\n", throughput);
	}

	public void printDelay(String msg) {
		int delay = (int) (durationMs * 1000 / Config.OBJ_COUNT);
		System.out.printf(msg + ". Delay: %.2f ms.\n", (double) delay / 1000);
	}
}
